

try:
    # a=1/0
    print('try')
except:
    print('except')
else:
    print('else')
finally:
    print('finally')

# 无异常的执行结果是:
    # try
    # else
    # finally
# 产生异常的执行结果是:
    # except
    # finally

# 自定义异常 raise Exception()
x = 10
if x > 5:
    raise Exception('x 不能大于 5。x 的值为: {}'.format(x))


